package com.example.travel.Adapter;

import android.content.Context;

import android.view.View;
import android.view.ViewGroup;

import androidx.viewpager.widget.PagerAdapter;

import java.util.ArrayList;

public class ViewPagerAdapter1 extends PagerAdapter {
    Context context;
    ArrayList<View> view_list;

    public ViewPagerAdapter1(Context context, ArrayList<View> view_list) {
        this.context = context;
        this.view_list = view_list;
    }

    @Override
    public int getCount() {
        return view_list.size();
    }

    @Override
    public boolean isViewFromObject( View view,  Object object) {
        return view==object;
    }


    @Override
    public Object instantiateItem( ViewGroup container, int position) {
        container.addView(view_list.get(position));
        return view_list.get(position);
    }

    @Override
    public void destroyItem( ViewGroup container, int position,  Object object) {
        container.removeView(view_list.get(position));
    }
}
